package com.lx.idea.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.idea.model.AnalysisTb;
import com.lx.idea.model.AnalysisTemplate;
import org.apache.ibatis.annotations.Mapper;
import com.lx.idea.model.StatisticCount;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AnalysisMapper extends BaseMapper<AnalysisTb>{

    @Select("select * from analysis_template_tb where id=#{id}")
    AnalysisTemplate getOne(@Param("id")long id);

    @Select("SELECT count(*) as count,create_date as dateTime  FROM analysis_tb WHERE create_date > #{minDate} AND create_date < #{maxDate} GROUP BY create_date")
    List<StatisticCount> getCount(@Param("minDate")String minDate, @Param("maxDate")String maxDate);


    @Select(value = "select * from analysis_tb")
    List<AnalysisTb> getPageList();
}
